<?php

/** 
* 
* 
* by:南宁火蝶科技有限公司 http:///www.HdsysCms.com
* 声明:本系统禁止用二次开发、侵犯HdsysCms著作和除去HdsysCms进行售卖,如发现将追究一切权利,模版制作属于自己所得可以通过本系统对外开发模版获取收益!
* 
* 2019年第一版本发布 - 到2023.9.1开源使用! 
* php混淆工具:phpencry.wbox.top
* 
* 注意防骗:@HdsysCms 官方没授权任何个人机构合作,唯一收款抬头:《南宁火蝶科技有限公司》和官网显示客服唯一渠道客服,其它渠道以HdsysCms名义行为均骗子!
*
*/
	

defined('HDSYS_SET') or call_my_die("" . 'Not,This File Not Can in Ie Open');
if (HDSYS_SET !='ADMIN') {
call_my_die("" . '访问路径错误');
}
class Contact
{
public function __construct()
{
$this->intelligence_session=bs_lib::load_libhdsys_class("" . 'session');
$this->intelligence_session->intelligence_session_open();
$this->intelligence_db=bs_lib::load_libhdsys_class(templates_Verifications_db());
bs_lib::load_modules_common();
isadminlogin();
}
public function call_edit_table_ajax()
{
$param_id=set_post("" . 'id');
$field=set_post("" . 'field');
$param_sql="UPDATE `hdsys_contact` SET `remarks`='{$field}' WHERE `id`='{$param_id}';";
$param_tmp=$this->intelligence_db->intelligence_query($param_sql);
if ($param_tmp) {
print_json(array(call_my_str_code()=> call_my_int_1(), call_my_str_msg()=> '修改成功'));
} else {
print_json(array(call_my_str_code()=> call_my_int_aeg1(), call_my_str_msg()=> '修改失败'));
}
}
public function call_table()
{
include bs_lib::load_default_path();
}
public function call_add()
{
include bs_lib::load_default_path();
}
public function call_del_ajax()
{
$param_id=set_post("" . 'id');
$param_sql="DELETE FROM `hdsys_contact` WHERE `id`='{$param_id}' ";
$param_tmp=$this->intelligence_db->intelligence_query($param_sql);
if ($param_tmp) {
print_json(array(call_my_str_code()=> call_my_int_1(), call_my_str_msg()=> '删除成功'));
} else {
print_json(array(call_my_str_code()=> call_my_int_aeg1(), call_my_str_msg()=> '删除失败'));
}
}
public function call_table_ajax()
{
$param_FANYE=(int)set_get('page');
if ($param_FANYE > 0) {
$param_db_ID=$param_FANYE - 1;
} else {
$param_db_ID=0;
$param_FANYE=1;
}
$param_shu=set_get('limit');
if ($param_shu==0) {
$param_shu=10;
}
$param_db_ID=$param_db_ID * $param_shu;
$param_where_sql='';
$param_soso=set_get('soso');
$param_soso_id=(int)set_get('soso_id');
$param_DESC_id=(int)set_get('DESC');
$param_DESC_id==1 ? $param_DESC='ASC' : $param_DESC='DESC';
if ($param_soso !='') {
if ($param_soso_id==1) {
if ($param_where_sql !='') {
$param_where_sql .=" AND ";
}
$param_where_sql .=" `title`  REGEXP '$param_soso'  ";
} elseif ($param_soso_id==2) {
if ($param_where_sql !='') {
$param_where_sql .=" AND ";
}
$param_where_sql .=" `name`  REGEXP '$param_soso'  ";
} elseif ($param_soso_id==3) {
if ($param_where_sql !='') {
$param_where_sql .=" AND ";
}
$param_where_sql .=" `type`  REGEXP '$param_soso'  ";
} elseif ($param_soso_id==4) {
if ($param_where_sql !='') {
$param_where_sql .=" AND ";
}
$param_where_sql .=" `contact`  REGEXP '$param_soso'  ";
} elseif ($param_soso_id==5) {
if ($param_where_sql !='') {
$param_where_sql .=" AND ";
}
$param_where_sql .=" `text`  REGEXP '$param_soso'  ";
} elseif ($param_soso_id==6) {
if ($param_where_sql !='') {
$param_where_sql .=" AND ";
}
$param_where_sql .=" `remarks`  REGEXP '$param_soso'  ";
} elseif ($param_soso_id==7) {
if ($param_where_sql !='') {
$param_where_sql .=" AND ";
}
$param_where_sql .=" `info1`  REGEXP '$param_soso'  ";
} else {
if ($param_where_sql=='') {
$param_where_sql .="  `name`  REGEXP '{$param_soso}' or `title`  REGEXP '{$param_soso}' or `type`  REGEXP '{$param_soso}' or `contact`  REGEXP '{$param_soso}' or  `text`  REGEXP '{$param_soso}' or `remarks`  REGEXP '{$param_soso}' or `info1`  REGEXP '{$param_soso}' or `info2`  REGEXP '{$param_soso}' or `info3`  REGEXP '{$param_soso}'  ";
} else {
$param_where_sql .=" AND(  `name`  REGEXP '{$param_soso}' or `title`  REGEXP '{$param_soso}' or `type`  REGEXP '{$param_soso}' or `contact`  REGEXP '{$param_soso}' or `text`  REGEXP '{$param_soso}' or `remarks`  REGEXP '{$param_soso}' or `info1`  REGEXP '{$param_soso}' or `info2`  REGEXP '{$param_soso}' or `info3`  REGEXP '{$param_soso}'  )";
}
}
}
if ($param_where_sql !='') {
$param_where_sql="WHERE" . $param_where_sql;
}
$param_sql="SELECT * FROM `hdsys_contact` {$param_where_sql}    ORDER BY`id`{$param_DESC} LIMIT {$param_db_ID},{$param_shu}";
$param_db_array_value=$this->intelligence_db->intelligence_query($param_sql);
$param_tmp_rows="select count(*)as 'hangshu' from `hdsys_contact`  {$param_where_sql}  ";
$param_tmp_arr=$this->intelligence_db->intelligence_array($param_tmp_rows);
$param_tmp_rows=(int)$param_tmp_arr['hangshu'];
$param_while_array_list_all=array();
while ($param_value=$this->intelligence_db->intelligence_assoc($param_db_array_value)) {
$param_value['add_time']=call_my_date('Y-m-d H:i:s', $param_value['add_time']);
$param_while_array_list_all[]=$param_value;
}
$param_json_array=array();
$param_json_array[call_my_str_data()]=(array) $param_while_array_list_all;
$param_json_array[call_my_str_code()]=0;
$param_json_array[call_my_str_msg()]='';
$param_json_array[call_my_str_count()]=$param_tmp_rows;
print_json($param_json_array);
}
function call_table_set_ajax()
{
$param_josn=set_post("" . 'josn');
$param_all=set_post("" . 'all');
$param_type=set_post("" . 'type');
if ($param_type==5) {
$param_sql="DELETE FROM `hdsys_contact` WHERE  `id` IN({$param_all}); ";
$param_tmp=plug_query($param_sql);
if ($param_tmp) {
$param_json_array=array();
$param_json_array[call_my_str_code()]=1;
$param_json_array[call_my_str_msg()]='执行删除成功';
print_json($param_json_array);
} else {
$param_json_array=array();
$param_json_array[call_my_str_code()]=-1;
$param_json_array[call_my_str_msg()]='执行删除失败';
print_json($param_json_array);
}
}
}
}
